/**
 * Created by Administrator on 2015/11/29.
 */
function  f(){
    var f1 = function(){
        console.log(this);
    };
    f1();
}

function f2(){
    //this.print1=function(){//cannot add a new property to this object
    //    console.log('hello');
    //}
    //this.b = 'bbb';//b also cannot add to this
    //console.log(this);//this is not equal with it in web browser
    //that we can add or edit properties to it,not only outside function but also inside.

}

//f();//{DTRACE_NET_SERVER_CONNECTION: [Function],.......}非常长的内容

//console.log(this);//{}

//var ff = new f();//与第一种情况一样

//f2();
//console.log(this);//{} 注明：f2不能改变this对象

//console.log(this.print());//this.print is not a function

this.a = 'aaa';
console.log(this.a);
console.log(this);
f2();
console.log(this);

function Person(name,age){
    this.name = name;
    this.age = age;
}

var f = new Person('dongge',12);
console.log(f);//Person { name: 'dongge', age: 12 }
var obj = {
    name : 'dongge',
    age:12,
    print:function(){
        console.log(this);
    }
}
obj.print();//{ name: 'dongge', age: 12, print: [Function] }